package com.example.service.impl;

import com.example.common.R;
import com.example.dao.NewsDao;
import com.example.dao.impl.NewsDaoImpl;
import com.example.pojo.entity.WmNews;
import com.example.service.NewsService;

public class NewsServiceImpl implements NewsService {


    NewsDao newsDao = new NewsDaoImpl();

    /**
     * 获取文章列表数据
     *
     * @return
     * @throws Exception
     */
    @Override
    public R getNewsList(String channelId, String title, Integer page, Integer size) throws Exception {
        return newsDao.getNewsList(channelId, title, page, size);
    }

    @Override
    public R getNewsDetail(String newsId) throws Exception {
        return newsDao.getNewsDetail(newsId);
    }

    /**
     * 获取头条热榜数据
     *
     * @return
     * @throws Exception
     */
    @Override
    public R getNewsHotTitle() throws Exception {
        return newsDao.getNewsHotTitle();
    }

    /**
     * 发布文章
     *
     * @param wmNews
     */
    @Override
    public R addNews(WmNews wmNews, String token) throws Exception {
        return newsDao.addNews(wmNews, token);
    }


    @Override
    public R getHotNewsList(Integer size) throws Exception {
        return newsDao.getHotNewsList(size);
    }

    @Override
    public R getPersonWorkList(Integer page, Integer size, String token,String title) throws Exception {
        return newsDao.getPersonWorkList(page, size, token,title);
    }

    @Override
    public R updatePersonWork( WmNews wmNews) throws Exception {
     return     newsDao.updatePersonWork(wmNews);
    }

    @Override
    public R deleteWork(String newsId) throws Exception {
        return     newsDao.deleteWork(newsId);
    }
}
